package lang;

class Student{
	String name;
	int age;
	
	public Student(String name, int age) {
		this.name = name;
		this.age = age;
	}

	//方法的重写
	public String toString() {
		return "我的名字叫"+name+"年龄"+age;
	}
	
	
}

// Object类
public class Test9 {

	public static void main(String[] args) {
		// 对象不能直接打印 lang.Student@15db9742
		 Student st=new Student("赵信", 18);
		 System.out.println(st);
		 System.out.println(st.toString()); //默认

	}

}
